package chapter25;

import java.util.Arrays;

public class Chapter25Main {

    public static void main(String[] args) {
        int[][] w = new int[5][5];
        w[0][1] = 3;
        w[0][2] = 8;
        w[0][4] = -4;
        w[1][3] = 1;
        w[1][4] = 7;
        w[2][1] = 4;
        w[3][0] = 2;
        w[3][2] = -5;
        w[4][3] = 6;
        for (int i = 0; i < 5; i++) {
            for (int j = 0; j < 5; j++) {
                if (i != j && w[i][j] == 0) {
                    w[i][j] = Integer.MAX_VALUE;
                }
            }
        }
        int[][] r1 = AllPairs.slowAllPairsShortestPaths(w);
        System.out.println(Arrays.deepToString(r1));
        int[][] r2 = AllPairs.fasterAllPairsShortestPaths(w);
        System.out.println(Arrays.deepToString(r2));

        int[][] r3 = FloydWarshall.floydWarshall(w);
        System.out.println(Arrays.deepToString(r3));


        FloydWarshall.Graph G = new FloydWarshall.Graph();
        int[][] edges = new int[4][4];
        edges[0][0] = 1;
        edges[1][1] = 1;
        edges[1][2] = 1;
        edges[1][3] = 1;
        edges[2][1] = 1;
        edges[2][2] = 1;
        edges[3][0] = 1;
        edges[3][2] = 1;
        edges[3][3] = 1;
        G.adj = edges;
        G.numVertexes = 4;
        int[][] r4 = FloydWarshall.transitiveClosure(G);
        System.out.println(Arrays.deepToString(r4));
    }

}
